< previous page page_244 next page >

Page 244
LISTING 11.2. THEBasicPersonalChecking's adjustBalanceMETHOD.

9f8044bafea36a1f728739c0bb58ef4c.gif
 1: Public Function adjustBalance (argObject As Deposit,
argAccountNumber As String) As Boolean
 2:     Dim LocalObject As Object, returns As Boolean
 3:
 4:     'If there's more than one account object in memory, a precondition
 5:     'is that this object is the correct object. So check account number
 6:     If argAccountNumber <> AccountNumber Then
 7:          'Raise exceptions here...
 8:         Dim sMsg As String
 9:         sMsg = Wrong account number, Please retry.
10:         RaiseEvent OnWrongAccountNumber (sMsg)
11:         'Set LocalObject = Nothing
12:         Exit Function
13:     End If
14:
15:     'Delegate to private methods, where only one will be able to
16:     'process the message.
17:
18:     Set LocalObject = argObject
19:
20:     returns = increaseBalance(LocalObject)
21:     If returns Then
22:         adjustBalance = returns
23:         Exit Function
24:         Set LocalObject = Nothing
25:     End If
26:
27:     returns = decreaseBalance(LocalObject)
28:     If returns Then
29:         adjustBalance = returns
30:         Exit Function
31:         Set LocalObject = Nothing
32:     End If
33:
34: End Function

New Term: Navigation is the act of a client object requesting services from a serving object.
Figure 11.3 illustrates the frmAccountMaintForm form. As you can see, it's simple. A use case that is realized by this form could be called Make a Deposit. A simple normal

 
< previous page page_244 next page >

If you like this book, buy it!